<template>
	<view class="p30 backf view-sche f28 lh48"
		><scheduleItem
			:item="item"
			v-for="item in scheduleList"
			v-bind:key="item.id"
			@refresh="getList"
			:viewDate="true"
		></scheduleItem
	></view>
</template>

<script>
import { listScheduleByJournalId } from '@/apis/calendar'
import scheduleItem from './components/scheduleItem.vue'
export default {
	components: {
		scheduleItem,
	},
	data() {
		return {
			scheduleList: [],
			startDate: '',
			endDate: '',
			journalId: '',
		}
	},
	methods: {
		getList() {
			const { startDate, endDate, journalId } = this
			const orgId = uni.getStorageSync('orgId')
			const schedulePriority = []
			const scheduleCategory = []
			listScheduleByJournalId({
				orgId,
				startDate,
				endDate,
				schedulePriority,
				scheduleCategory,
				journalId,
			}).then((res) => {
				this.scheduleList = res.data
			})
		},
	},
	onShow() {
		this.getList()
	},
	onLoad(options) {
		this.journalId = options.journalId
		this.startDate = options.startDate
		this.endDate = options.endDate
	},
}
</script>

<style lang="scss" scoped>
.view-sche {
	height: calc(100vh - 60rpx);
}
.lh48 {
	line-height: 48rpx;
}
</style>
